<!--Search Form -->
<?php
$auth = $this->auth;
$search_val = $this->search_val;
$view = $this->view;
?>
<!-- start: Wrapper -->
<div id="wrapper">

    <!-- start: Container -->
    <div class="container">
        <!-- start: Portfolio -->
        <div class="sixteen columns">

            <ul class="tabs-nav" style="float: right">
                <li id="grid" ><a href="?view=grid"><i class="mini-ico-th"></i>Dạng lưới </a></li>
                <li id="list"><a href="?view=list"><i class="mini-ico-list"></i>Dạng danh sách</a></li>
            </ul>
            <input type="hidden" name="view" id="view" value="<?php echo $view ?>">
            <div class="tabs-container white-wrapper">
                <div id="portfolio-wrapper">
                    <?php foreach($topics as $item): ?>


                        <div class="sixteen columns portfolio-item">
                            <div class="three columns picture" style="height: 200px; overflow: hidden">
                                <a  href="/topic/detail/<?php echo $item->id ?>"><img   src="<?php echo $item->images ?>"></a>
                                <?php $count_img = Velacolib\Utility\Utility::image_topic($item->id);
                                if($count_img != 0){  ?>
                                    <div class="count_photos"><?php echo $count_img ?> photo</div>
                                <?php  } ?>

                            </div>
                            <div class="nine columns topic-listing-title">
                                <h4> <a href="/topic/detail/<?php echo $item->id ?>">[ <?php echo Velacolib\Utility\Utility::getProductType($item->topic_type); ?></php>
                                        ] <?php echo $item->title; ?></a> </h4>
                                <h6>
                                    <a href="/?search_loc=<?php echo $item->topic_location; ?>">  <?php echo Velacolib\Utility\Utility::getLocationArray($item->topic_location); ?></a>
                                    <?php if($item->cat_id){ ?>
                                        <a href="/?search_cat=<?php echo $item->cat_id; ?>"> -  Mặc Hàng: <?php $topic_cat =  Velacolib\Utility\Utility::getTopicCat()->getCategories($item->cat_id); echo $topic_cat->title;  ?></a>
                                    <?php } ?>

                                </h6>
                                <div class="item-description alt">
                                    <?php echo  Velacolib\Utility\Utility::limit_words($item->full_description,50); ?>
                                </div>
                            </div>
                            <div class="three columns price-listing">
                                <div><span style="font-weight: bold;font-size: 18px;"><?php echo number_format($item->price) ?></span> VND</div>
                            </div>
                        </div>
                    <?php endforeach ?>
                </div>
                <!-- end: Portfolio -->
                <!--paginator -->
                <div class="row-fluid" align="center">
                    <?php
                    // add at the end of the file after the table
                    echo $this->paginationControl(
                    // the paginator object
                        $topics,
                        // the scrolling style; see http://zf2.readthedocs.org/en/release-2.1.4/modules/zend.paginator.usage.html#rendering-pages-with-view-scripts
                        'sliding',
                        // the partial to use to render the control
                        array('partial/paginator.phtml', 'Topic'),
                        // the route to link to when a user clicks a control link
                        array(
                            'route' => 'frontenduser',
                            'child_route' => array(
                                'controller'=>'user',
                                'action' => 'topic',
                                'param'=>$param,
                            ),
                            'search_val'=>$search_val
                        )
                    );
                    ?>
                </div>
                <!--end paginator -->
            </div>
        </div>
    </div>

</div>

<style>
    #div_extend, #div_extend_res {
        float: left;
        width: 100%;
        text-align: center;
        cursor: pointer;
        margin-top: 5px;
        margin-bottom: 5px;
    }
</style>